package cn.ddiancan.xddcloud.psc.base.controller;

import cn.ddiancan.xddcloud.common.security.AesService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/scheduler/security")
@Tag(name = "Aes加解密", description = "Aes加解密")
@RequiredArgsConstructor
public class AesSecurityController {

    private final AesService asService;

    @GetMapping(value = "/decrypt")
    @Operation(summary = "解密", description = "解密")
    public String decrypt(@RequestParam("encryptedContent") String encryptedContent) {
        return asService.decrypt(encryptedContent);
    }

    @GetMapping(value = "/encrypt")
    @Operation(summary = "加密", description = "加密")
    public String encrypt(@RequestParam("content") String content) {
        return asService.encrypt(content);
    }
}
